package cn.jiyun.mapper;

import cn.jiyun.pojo.Dev;
import cn.jiyun.pojo.Project;
import org.apache.ibatis.annotations.*;

import java.util.List;
import java.util.Map;


public interface DevMapper {

    int add(Dev developer);

    List<Map> findAll(@Param("pageNum") int pageNum, @Param("pageSize") Integer pageSize, @Param("queryString") String queryString);

    @Select("select count(*) from developer ")
    Long getCount();

    @Update("UPDATE `building_project`.`developer` SET `dname` = #{dname}, `updatetime` = #{updatetime}  WHERE `did` = #{did}")
    int update(Dev developer);

    @Delete("delete from  developer where did=#{did} ")
    int delete(Integer did);

    @Select("select * from developer where did=#{did}")
    Dev findById(Integer did);

    @Select("select * from project p where p.did=#{did} ")
    Project findByPro(Integer did);

    @Select("select * from project p ,developer d where p.did=d.did and p.did in(select did from developer where did= #{did})")
    List<Map> findBySid(Integer did);
    @Select("select * from project p where p.pid in (select p.pid from project p,developer d where p.did=d.did and p.did =#{did} )")
    List<Project> findProjectList(Integer did);
    @Select("select * from project p where  p.did is null")
    List<Project> findProjectList2();
    @Update("update project set did = 0 where did =#{did}")
    void clean(Integer did);
    @Select("select * from developer")
    List<Dev> findName();
}
